package com.qlk.vorder.domain.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 支付类型枚举
 * 
 * @author js
 * 
 */
public enum PayTypeEnum {

	OTHER(0, "其他"), OPERATION(1, "后台操作"), MANUAL_REFUND(2, "手工退款"), ALIPAY(3, "支付宝"), WWCHAT(4, "微信"), BANKCAED(5, "银行卡");

	int type;

	String name;

	PayTypeEnum(int type, String name) {
		this.type = type;
		this.name = name;
	}

	public static String getName(int type) {
		for (PayTypeEnum ele : PayTypeEnum.values()) {
			if (ele.getType() == type)
				return ele.getName();
		}
		return null;
	}

	public static Map<Integer, String> getMap() {
		Map<Integer, String> dataMap = new HashMap<Integer, String>();
		for (PayTypeEnum enumObj : PayTypeEnum.values()) {
			dataMap.put(enumObj.getType(), enumObj.getName());
		}
		return dataMap;
	}

	public static List<Map<String, Object>> getList() {
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		for (PayTypeEnum ele : PayTypeEnum.values()) {
			Map<String, Object> map = new HashMap<String, Object>();
			map.put("key", ele.getType());
			map.put("value", ele.getName());
			list.add(map);
		}
		return list;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}
